Creating an Annotation Table
The first thing needed for annotations is a table that stores them.
These are the CREATE TABLE and CREATE SEQUENCE statements for a table that stores annotations for the customers table used previously:
CREATE TABLE customers_text (
customers_text_id NUMBER,
customers_ref NUMBER,
angle NUMBER,
cust_text_location SDO_GEOMETRY);
CREATE SEQUENCE customers_text_seq
START WITH 1001 INCREMENT BY 1;
As with the parent table (customers), a sequence is created to ensure that the table’s identifier (here: customer_text_id) will be unique when annotations are added or removed in Bentley Map.
Next to the table’s identifier, a column that references the identifier in the root table is specified (customers_ref). The column angle will store the angle that the text is placed under (note: could either be radians or degrees – this can be specified when registering the feature) and the SDO_GEOMETRY field stores the location of the text element.
Like for any spatial table, an entry in the USER_SDO_GEOM_METADATA view and a spatial index are required for Bentley Map to work with the table:
INSERT INTO user_sdo_geom_metadata
(TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
VALUES
('CUSTOMERS_TEXT', 'CUST_TEXT_LOCATION',
SDO_DIM_ARRAY
(SDO_DIM_ELEMENT('LONG', -180.0, 180.0, 0.5),
SDO_DIM_ELEMENT('LAT', -90.0, 90.0, 0.5)),
8307);
CREATE INDEX customers_text_sidx ON customers_text(cust_text_location)
INDEXTYPE IS mdsys.spatial_index
PARAMETERS ('layer_gtype=POINT');